import { AnyObject } from "@/types";
import { paramsUtils } from "@/utils";
import { reactive } from "vue";

export type ICodeParams<T> = {
  [key in keyof T]?: any;
};
/**
 * @description 获取聚合支付二维码参数
 */
export const useUrlParams = <T extends AnyObject>(url?: string) => {
  const params = reactive<T>(paramsUtils.getUrlParams<T>(url));
  return params;
};

export default useUrlParams;
